<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1">
	<meta name="description" content="A fully featured admin theme which can be used to build CRM, CMS, etc.">
	<meta name="author" content="Coderthemes">

	<!-- jQuery  -->
	<script type="text/javascript" src="/static/plugins/jquery/jquery-3.6.0.min.js"></script>

	<link rel="stylesheet" href="/static/plugins/layui/2.8.4/css/layui.css" media="all">
	<script src="/static/plugins/layui/2.8.4/layui.js" charset="utf-8"></script>

	<link rel="stylesheet" href="/static/admin/css/mini-ease-edit.css">

	<style>
		.treeDiv{
			width: 90%;
			margin: 0 auto;
			padding-top: 10px;
		}
	</style>


</head>
<body>

<form class="layui-form" id="formId" method="post" action="/api/inter/tpShopRegisterPhaseSet/edit">

	<!--分行-->
	<div class="layui-form-item">
		<!--设置类型-->
		<div class="layui-inline layui-col-xs6 margin_r0">
			<div>
				<label class="layui-form-label">流程类型：</label>
				<div class="layui-input-block">
					<select lay-filter="select-selectPhaseType" id="selectPhaseType" disabled>
						<option value="">请选择</option>
						<option value="0" th:selected="${dto.phaseType eq '0'} ? 'true' : 'false'">主流程</option>
					</select>
				</div>
			</div>
		</div>

		<!--阶段名 id="ID-dropdown-demo-content"-->
		<div class="layui-inline layui-col-xs6 margin_r0" id="chooseParentCol">
			<label class="layui-form-label">父节点：</label>
			<div id="chooseParentDiv">
				<div th:if="${dto.phaseType eq '1'}" class="layui-input-block margin_l_90" style="display: flex;">
					<!--
					<input type="text" autocomplete="off" class="layui-input" id="dropdownInput" th:value="${dto.parentName}" style="border: solid 0.1px; border-color: #B5B5B5; width:90%;" readonly="readonly">
					<i style="position: relative; right: 25px; height: 30px; line-height: 30px;" class="layui-icon layui-icon-more"></i>
					-->
					<span style="padding-left:10px;padding-top: 6px;" th:text="${dto.parentName}"></span>

				</div>
				<div th:if="${dto.phaseType eq '0'}" class="layui-input-block margin_l_90" style="display: flex;">
					<!--<input type="text" autocomplete="off" class="layui-input" readonly="true" value="主流程无需选择父节点" style="width:90%;">-->
					<span style="padding-left:10px;padding-top: 6px;">主流程无父节点</span>
				</div>
			</div>
		</div>
	</div>


	<!--分行-->
	<div class="layui-form-item" id="chooseTypeRow">
		<!--设置类型-->
		<div class="layui-inline layui-col-xs6 margin_r0">
			<div>
				<label class="layui-form-label">阶段节点类型：</label>
				<div class="layui-input-block" >
					<select lay-filter="select-selectType" id="selectSetType" disabled>
						<option value="">请选择</option>
						<option value="0" th:selected="${dto.setType eq '0'} ? 'true' : 'false'">阶段任务</option>
						<option value="1" th:selected="${dto.setType eq '1'} ? 'true' : 'false'">分支集合</option>
						<option value="2" th:selected="${dto.setType eq '2'} ? 'true' : 'false'">任务分支</option>
					</select>
				</div>
			</div>
		</div>
		<!--阶段名-->
		<div class="layui-inline layui-col-xs6 margin_r0">
			<div>
				<label class="layui-form-label"><font class="f_red">*</font>阶段名称：</label>
				<div class="layui-input-block" id="phaseNameDiv">
					<input type="text" name="phaseName" id="phaseName" th:value="${dto.phaseName}" autocomplete="off" class="layui-input" lay-verify="required" maxlength="30" style="width:90%;">
				</div>
			</div>
		</div>
	</div>



	<!--分行-->
	<div class="layui-form-item" id="chooseCountRow">

		<!--阶段-->
		<div class="layui-inline layui-col-xs6 margin_r0" id="phaseNumDiv">
			<div class="layui-input-group">
				<label class="layui-form-label"><font class="f_red">*</font>阶段顺序：</label>
				<div class="layui-input-block">
					<div style="float: left;margin-right: 5px;">
						<button type="button" class="layui-btn layui-btn-sm" onclick="phaseNumDown()">
							<i class="layui-icon layui-icon-subtraction"></i>
						</button>
					</div>
					<input type="number" name="phaseNumShow" id="phaseNumShow" th:value="${dto.phaseNum}" autocomplete="off"  readonly="readonly"  class="layui-input" style="float: left;width: 100px;text-align: center;margin-right: 5px;" >
					<div style="float: left;">
						<button type="button" class="layui-btn layui-btn-sm" onclick="phaseNumAdd()">
							<i class="layui-icon layui-icon-add-1"></i>
						</button>
					</div>
				</div>
			</div>
		</div>

		<!--时效 oninput="if(value.length>6)value=value.slice(0,6);"-->
		<div class="layui-inline layui-col-xs6 margin_r0" id="workTimeDiv">
			<div>
				<label class="layui-form-label"><font class="f_red">*</font>时效：</label>
				<div class="layui-input-block">
					<input type="number" name="workTime" th:value="${dto.workTime}"  oninput="value=value.replace(/^(0+)|[^\d]+/g,'')" autocomplete="off"  class="layui-input" style="width:90%;" >
				</div>
			</div>
		</div>
	</div>



	<!--分行-->
	<div class="layui-form-item" id="chooseDeptRow">
		<div class="layui-inline layui-col-xs6 margin_r0">
			<label class="layui-form-label"><font class="f_red">*</font>负责部门：</label>
			<div class="layui-input-block margin_l_90" style="display: flex;">
				<input type="text" id="organizationInfo" name="organizationInfo" autocomplete="off" class="layui-input" th:value="${dto.DeptName}"  style="border: solid 0.1px; border-color: #B5B5B5; width:90%;" readonly="readonly">
				<i class="layui-icon layui-icon-close-fill" style="height: 30px; line-height: 30px;" title="清空此条件" onclick="this.previousSibling.previousSibling.value = '';this.previousSibling.previousSibling.previousSibling.previousSibling.value = '';"></i>
				<i style="position: relative; right: 40px; height: 30px; line-height: 30px;" class="layui-icon layui-icon-more" th:onclick="showModalSelectorOrg()"></i>
			</div>
		</div>
		<div class="layui-inline layui-col-xs6 margin_r0">
			<label class="layui-form-label"><font class="f_red">*</font>负责人：</label>
			<div class="layui-input-block margin_l_90" style="display: flex;">
				<input type="text" id="pointUserInfo" autocomplete="off" class="layui-input" th:value="${dto.headUser}" style="border: solid 0.1px; border-color: #B5B5B5; width:90%;" readonly="readonly">
				<i class="layui-icon layui-icon-close-fill" style="height: 30px; line-height: 30px;" title="清空此条件" onclick="this.previousSibling.previousSibling.value = '';this.previousSibling.previousSibling.previousSibling.previousSibling.value = '';"></i>
				<i style="position: relative; right: 40px; height: 30px; line-height: 30px;" class="layui-icon layui-icon-more" th:onclick="showModalSelectorPointUser()"></i>
			</div>
		</div>
	</div>

	<!--隐藏域-->
	<input type="hidden" name="id" id="id" th:value="${dto.id}">
	<input type="hidden" name="nodeLft" id="nodeLft" th:value="${dto.NodeLft}"><!--负责部门相关参数-->
	<input type="hidden" name="nodeRgt" id="nodeRgt" th:value="${dto.NodeRgt}">
	<input type="hidden" name="headUserId" id="pointUserId" th:value="${dto.headUserId}"><!--负责人-->
	<input type="hidden" name="pointDeptCode" id="pointDeptCode" th:value="${dto.DeptId}"><!--负责部门-->

	<input type="hidden" name="phaseType" id="phaseType" th:value="${dto.phaseType}"><!--流程类型-->
	<input type="hidden" name="parentId" id="parentId" th:value="${dto.parentId}"><!--父id-->
	<input type="hidden" name="setType" id="setType" th:value="${dto.setType}"><!--阶段节点类型-->
	<input type="hidden" name="phaseNum" id="phaseNum" th:value="${dto.phaseNum}"><!--阶段顺序-->
	<input type="hidden" name="maxPhaseNum" id="maxPhaseNum"  th:value="${dto.maxPhaseNum}"><!--能设置的最大阶段顺序-->
	<input type="hidden" name="parentNodeInfo" id="parentNodeInfo"  th:value="${dto.parentNode}"><!--父节点-->
	<input type="hidden" name="childrenLength" id="childrenLength"  th:value="${dto.childrenLength}"><!--子节点数量-->
	<input type="hidden" name="parentSetType" id="parentSetType"  th:value="${dto.parentSetType}"><!--父节点类型-->

	<!--部分需要保存时进行对比的旧数据-->
	<input type="hidden" name="oldPhaseType" id="oldPhaseType" th:value="${dto.phaseType}"><!--流程类型-->
	<input type="hidden" name="oldParentId" id="oldParentId" th:value="${dto.parentId}"><!--父id-->
	<input type="hidden" name="oldSetType" id="oldSetType" th:value="${dto.setType}"><!--阶段节点类型-->
	<input type="hidden" name="oldPhaseNum" id="oldPhaseNum" th:value="${dto.phaseNum}"><!--阶段顺序-->


	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"></fieldset>
	<div class="layui-form-item">
		<div class="layui-col-md1 layui-col-md-offset11">
			<div class="layui-btn-container">
				<button type="button" class="layui-btn" lay-submit lay-filter="formSubmit">保存</button>
			</div>
		</div>
	</div>
</form>

<script>
	$(function () {

		//节点类型（0阶段任务，1分支集合，2任务分支）
		if($('#setType').val()=='1'){//分支集合
			$('#workTimeDiv').hide();//时效隐藏
			$('#chooseDeptRow').hide();//部门、负责人隐藏
		}
		if($('#setType').val()=='2'){//任务分支
			$('#chooseCountRow').hide();//阶段顺序、时效隐藏
			$('#chooseDeptRow').hide();//部门、负责人隐藏
		}

		var tableDataJson = window.sessionStorage.getItem("tableData");
		var tableData = JSON.parse(tableDataJson);
		var isListType = false;
		if(tableData!=null && tableData.length>0){
			for(var i=0;i<tableData.length;i++){
				if(tableData[i].setType=='1'){//如果有分支集合的类型
					isListType = true;
				}
			}
		}


		layui.use(function(){
			var form = layui.form;
			var dropdown = layui.dropdown;
			var layer = layui.layer;
			var util = layui.util;
			var tree = layui.tree;
			var clistDataNew = [];
			var allSetList = [];
			$.ajax({
				url: '/api/inter/tpShopRegisterPhaseSet/getParentList',
				data: {},
				type: 'POST',
				async: true,
				success: function (result) {
					if (result.code == '0') {
						clistDataNew = result.listData;
						allSetList = result.allSetList;
						//console.log('clistDataNew',clistDataNew);
						//树加载
						dropdownTreeLoad(dropdown,tree,form,clistDataNew,allSetList);
					} else {
						layer.msg('出问题了，请稍后重试！', {icon: 2});
						setTimeout(function () {
							window.parent.location.reload();
						}, 1000);
					}
				}
			});
			if(isListType){
				var htmlStr = '<option value="">请选择</option>';
				if($('#phaseType').val()=='0'){
					htmlStr += '<option value="0" selected="true" >主流程</option><option value="1">分支流程</option>';
				}else {
					htmlStr += '<option value="0" >主流程</option><option value="1" selected="true">分支流程</option>';
				}
				//设置流程类型选项
				$('#selectPhaseType').html(htmlStr);
				form.render('select');
			}



			//流程类型（0主流程，1分支流程）
			//节点类型（0阶段任务，1分支集合，2任务分支）
			if($('#phaseType').val()=='0'){//主流程
				//设置阶段节点类型选项
				var htmlStr = '<option value="">请选择</option>';
				if($('#setType').val()=='0'){
					htmlStr += '<option value="0" selected="true" >阶段任务</option><option value="1">分支集合</option>';
				}else {
					htmlStr += '<option value="0" >阶段任务</option><option value="1" selected="true">分支集合</option>';
				}
				$('#selectSetType').html(htmlStr);
			}else {//分支流程
				var htmlStr = '';
				if($('#parentSetType').val()=='1'){//父节点类型：分支集合
					htmlStr += '<option value="2" selected="true" >任务分支</option>';
				}
				if($('#parentSetType').val()=='2'){//父节点类型：任务分支
					htmlStr = '<option value="">请选择</option>';
					if($('#setType').val()=='0'){
						htmlStr += '<option value="0" selected="true" >阶段任务</option><option value="1">分支集合</option>';
					}else {
						htmlStr += '<option value="0" >阶段任务</option><option value="1" selected="true">分支集合</option>';
					}
				}
				$('#selectSetType').html(htmlStr);
			}
			form.render('select');



			// 表单提交，共用同一个
			form.on('submit(formSubmit)', function(data){
				console.log('data',data);
				if(data.field.phaseType ==undefined || data.field.phaseType ==null || data.field.phaseType ==''  ){
					layer.msg('请选择流程类型', {icon: 0});
					return ;
				}
				if(data.field.parentId ==undefined || data.field.parentId ==null || data.field.parentId =='' ){
					layer.msg('请选择父节点', {icon: 0});
					return ;
				}
				if($('#setType').val() ==undefined || $('#setType').val() ==null || $('#setType').val() =='' ){
					layer.msg('请选择阶段节点类型', {icon: 0});
					return ;
				}
				if(data.field.phaseName ==undefined || data.field.phaseName ==null || data.field.phaseName =='' ){
					layer.msg('请填写阶段名称', {icon: 0});
					return ;
				}

				data.field.phaseNum =  data.field.phaseNumShow;
				if($('#setType').val()=='1'){//分支集合
					if(data.field.phaseNum ==undefined || data.field.phaseNum ==null || data.field.phaseNum ==''){
						layer.msg('请选择阶段顺序', {icon: 0});
						return ;
					}
					data.field.workTime  = "";//时效置空
					data.field.organizationInfo = "";//负责部门置空
					data.field.headUserId = "";//负责人置空
				}else if($('#setType').val()=='0'){//阶段任务
					if(data.field.phaseNum ==undefined || data.field.phaseNum ==null || data.field.phaseNum =='' ){
						layer.msg('请选择阶段顺序', {icon: 0});
						return ;
					}
					if(data.field.workTime ==undefined || data.field.workTime ==null || data.field.workTime =='' ){
						layer.msg('请填写时效信息', {icon: 0});
						return ;
					}
					if(data.field.organizationInfo ==undefined || data.field.organizationInfo ==null || data.field.organizationInfo =='' ){
						layer.msg('请选择负责部门', {icon: 0});
						return ;
					}
					if(data.field.headUserId ==undefined || data.field.headUserId ==null || data.field.headUserId =='' ){
						layer.msg('请选择负责人', {icon: 0});
						return ;
					}
				}else {//任务分支
					data.field.workTime  = "";//时效置空
					data.field.organizationInfo = "";//负责部门置空
					data.field.headUserId = "";//负责人置空
				}

				//一些类型新旧发生变化的时候
				//分支集合（有子集的时候）-》任务分支、阶段任务
				//任务分支（有子集的时候）-》分支集合、阶段任务
				if((($('#oldSetType').val()=='1' && $('#setType').val()!='1')||($('#oldSetType').val()=='2' && $('#setType').val()!='2')) && $('#childrenLength').val()!='0'){
					layer.confirm('您更改了该节点的类型，修改时该节点的子节点将会删除，确定要继续吗？', {icon: 3}, function(){
						var indexOfLoading = layer.load(1, {
							shade: [0.5,'#000000'] //0.1透明度的白色背景
						});
						$.post(data.form.action, data.field, function(res){
							if (res.code == 0) {
								layer.msg(res.msg);
								setTimeout(function(){
									window.parent.location.reload();
								}, 1000);
							} else {
								layer.close(indexOfLoading);
								layer.msg(res.msg, {icon: 2});
							}
						});
						return false;
					}, function(){
						return;
					});
				}else {
					var indexOfLoading = layer.load(1, {
						shade: [0.5,'#000000'] //0.1透明度的白色背景
					});
					$.post(data.form.action, data.field, function(res){
						if (res.code == 0) {
							layer.msg(res.msg);
							setTimeout(function(){
								window.parent.location.reload();
							}, 1000);
						} else {
							layer.close(indexOfLoading);
							layer.msg(res.msg, {icon: 2});
						}
					});
					return false;
				}
			});



			//选中下拉框-流程类型
			form.on('select(select-selectPhaseType)', function(data){
				var value = data.value; // 获得被选中的值
				var oldChoose = $('#phaseType').val();
				if(oldChoose!=value){
					if(value=='0'){//如果是主流程
						$('#phaseType').val(0);
						$('#chooseParentCol').show();//父节点-显示
						//设置父节点-无需选择
						$('#chooseParentDiv').html(
								'<div class="layui-input-block margin_l_90" style="display: flex;">'
								+'<input type="text" autocomplete="off" class="layui-input" readonly="true" value="主流程无需选择父节点" style="width:90%;">'
								+'</div>'
						);
						$('#parentId').val(-1);//父id
						$('#chooseTypeRow').show();//第二行显示
						//设置阶段节点类型选项
						$('#selectSetType').html(
								'<option value="">请选择</option>' +
								'<option value="0">阶段任务</option>' +
								'<option value="1">分支集合</option>'
						);
						form.render('select');

						$('#chooseCountRow').show();//第三行显示
						$('#workTimeDiv').hide();//时效隐藏
						//获取主流程最大的顺序
						var maxPhaseNum = 0;
						if(tableData!=null && tableData.length>0){
							maxPhaseNum = tableData.length;
						}
						//maxPhaseNum = maxPhaseNum + 1;
						$("#maxPhaseNum").val(maxPhaseNum);
						$("#phaseNum").val(maxPhaseNum);
						$("#phaseNumShow").val(maxPhaseNum);


					}else if(value=='1') {//如果是分支流程流程
						$('#phaseType').val(1);
						$('#chooseParentCol').show();//父节点-显示
						$('#chooseParentDiv').html(
								'<div class="layui-input-block margin_l_90" style="display: flex;" id="ID-dropdown-demo-content">'
								+'<input type="text" autocomplete="off" id="dropdownInput" class="layui-input" value="" style="border: solid 0.1px; border-color: #B5B5B5; width:90%;" readonly="readonly">'
								+'<i style="position: relative; right: 25px; height: 30px; line-height: 30px;" class="layui-icon layui-icon-more"></i>'
								+'</div>'
						);
						$('#dropdownInput').val('');//父id置空
						$('#parentId').val(null);//父id置空

						//后三行隐藏
						$("#chooseTypeRow").hide();
						$("#chooseCountRow").hide();
						$("#chooseDeptRow").hide();

						// 父节点选择
						dropdownTreeLoad(dropdown,tree,form,clistDataNew,allSetList);
					}else {//如果未选择
						$('#phaseType').val('');
						hideAll();
					}

					//一些参数置空
					$('#headUserId').val('');
					$('#pointDeptCode').val('');
					$('#setType').val('');
					//$('#phaseNum').val('');
					//$('#maxPhaseNum').val('');
				}

			});


			//选中下拉框-阶段节点类型
			form.on('select(select-selectType)', function(data){
				var value = data.value; // 获得被选中的值
				var oldSetType = $('#setType').val();
				if(oldSetType != value){
					if(value=='1'){//分支集合
						$('#chooseDeptRow').hide();//负责部门、负责人隐藏
						$('#workTimeDiv').hide();//时效隐藏
						$('#pointDeptCode').val('');
						$('#headUserId').val('');
					}else if(value=='2'){//任务分支
						$('#chooseDeptRow').hide();//负责部门、负责人隐藏
						$('#workTimeDiv').hide();//时效隐藏
						$('#pointDeptCode').val('');
						$('#headUserId').val('');
					}else {//普通任务
						$('#chooseDeptRow').show();//负责部门、负责人显示
						$('#workTimeDiv').show();//时效显示

					}
					$('#setType').val(value);
				}

			});

			layui.code();
		});


	});


	//树的设置
	function dropdownTreeLoad(dropdown,tree,form,clistDataNew,allSetList) {
		dropdown.render({
			id:'choosedDropdown',
			elem: '#ID-dropdown-demo-content',
			content: ['<div class="treeDiv"><div id="ID-tree-demo"></div></div>'].join(''),
			className: 'demo-dropdown-tabs',
			style: 'width: 370px; height: 200px; box-shadow: 1px 1px 30px rgb(0 0 0 / 12%);',
			ready: function(){
				layui.use(function(){
					tree.render({
						elem: '#ID-tree-demo',
						data: clistDataNew,
						onlyIconControl: true,  // 是否仅允许节点左侧图标控制展开收缩
						id: 'demo-id-1',
						click: function(obj){
							var data = obj.data;  //获取当前点击的节点数据
							//console.log('tree:',data);
							var setType = data.setType;
							if(setType=='1' && $('#parentId').val()!=data.id){//分支列表
								var parentNodeNew='';
								if(data.parentNode ==undefined || data.parentNode==null || data.parentNode==''){
									parentNodeNew = data.id;
								}else {
									parentNodeNew = data.parentNode + ',' + data.id;
								}
								$('#parentNodeInfo').val(parentNodeNew);//所有父节点
								$('#parentId').val(data.id);//父id
								$('#dropdownInput').val(data.phaseName);//父节点
								$('#chooseTypeRow').show();//第二行显示
								//设置阶段节点类型选项
								$('#selectSetType').html('<option value="2" selected>任务分支</option>');
								form.render('select');
								$('#setType').val(2);
								//后二行隐藏
								$("#chooseCountRow").hide();
								$("#chooseDeptRow").hide();
								//一些参数置空
								$('#headUserId').val('');
								$('#pointDeptCode').val('');

								//获取主流程最大的顺序，其实可以不设置，但为了后续方便蛮设置
								var maxPhaseNum = 0;
								if(allSetList!=null && allSetList.length>0 ){
									for(var i=0;i<allSetList.length;i++){
										if(allSetList[i].parentId==data.id){
											maxPhaseNum ++ ;
										}
									}
								}
								//maxPhaseNum = maxPhaseNum+1;

								$("#maxPhaseNum").val(maxPhaseNum);
								$("#phaseNum").val(maxPhaseNum);
								$("#phaseNumShow").val(maxPhaseNum);

							}else if(setType=='2' && $('#parentId').val()!=data.id){//任务分支
								var parentNodeNew='';
								if(data.parentNode ==undefined || data.parentNode==null || data.parentNode==''){
									parentNodeNew = data.id;
								}else {
									parentNodeNew = data.parentNode + ',' + data.id;
								}
								$('#parentNodeInfo').val(parentNodeNew);//所有父节点
								$('#parentId').val(data.id);//父id
								$('#dropdownInput').val(data.phaseName);//父节点
								$('#chooseTypeRow').show();//第二行显示
								//设置阶段节点类型选项
								$('#selectSetType').html('<option value="">请选择</option><option value="0">阶段任务</option><option value="1">分支集合</option>');
								form.render('select');
								$('#chooseCountRow').show();//第三行显示
								$('#workTimeDiv').hide();//时效隐藏
								//获取该分支流程最大的顺序
								var maxPhaseNum = 0;
								if(allSetList!=null && allSetList.length>0 ){
									for(var i=0;i<allSetList.length;i++){
										if(allSetList[i].parentId==data.id){
											maxPhaseNum ++ ;
										}
									}
								}
								//maxPhaseNum = maxPhaseNum+1;

								$("#maxPhaseNum").val(maxPhaseNum);
								$("#phaseNum").val(maxPhaseNum);
								$("#phaseNumShow").val(maxPhaseNum);v
								//一些参数置空
								$('#headUserId').val('');
								$('#pointDeptCode').val('');
							}else if(data==undefined || data==null){//未选择
								if($('#parentId').val()!=null || $('#parentId').val()!=''){
									//$('#setType').val('');//置空
									$('#dropdownInput').val('');//父节点置空
									$('#parentId').val(null);//父id置空
									//后三行隐藏
									$("#chooseTypeRow").hide();
									$("#chooseCountRow").hide();
									$("#chooseDeptRow").hide();
									//一些参数置空
									$('#headUserId').val('');
									$('#pointDeptCode').val('');
									$('#setType').val('');
									$('#phaseNum').val('');
									$('#maxPhaseNum').val('');
								}
							}
							dropdown.close('choosedDropdown');
						}
					});
				});
			}
		});


	}



	//隐藏全部
	function hideAll() {
		$("#chooseParentCol").hide();
		$("#chooseTypeRow").hide();
		$("#chooseCountRow").hide();
		$("#chooseDeptRow").hide();
	}

	//数字框减少
	function phaseNumDown(){
		var nowNum = $("#phaseNumShow").val();
		if(nowNum==null){
			if($("#phaseType").val()==null || $("#phaseType").val()==''){
				layer.msg('请先选择流程类型', {icon: 0});
				return ;
			}
			if($("#setType").val()==null || $("#setType").val()==''){
				layer.msg('请先选择阶段节点类型', {icon: 0});
				return ;
			}
		}
		if( nowNum!=1 ){
			$("#phaseNum").val( parseInt(nowNum) - 1 );
			$("#phaseNumShow").val( parseInt(nowNum) - 1 );
		}
	}
	//数字框增加
	function phaseNumAdd(){
		var nowNum = $("#phaseNumShow").val();
		if(nowNum==null){
			if($("#phaseType").val()==null || $("#phaseType").val()==''){
				layer.msg('请先选择流程类型', {icon: 0});
				return ;
			}
			if($("#setType").val()==null || $("#setType").val()==''){
				layer.msg('请先选择阶段节点类型', {icon: 0});
				return ;
			}
		}
		var maxPhaseNum = $("#maxPhaseNum").val();
		if( nowNum < maxPhaseNum ){
			$("#phaseNum").val( parseInt(nowNum) + 1 );
			$("#phaseNumShow").val( parseInt(nowNum) + 1 );
		}
	}

	function showModalSelectorOrg() {
		var w=($(window).width()*0.9);
		var h=($(window).height() - 50);
		layer.open({
			type: 2,
			area: [w+'px', h +'px'],
			fix: true,
			maxmin: false,
			shadeClose: true,
			shade:0.4,
			title: "选择",
			content: '/web/business/tpDeptUserPoint/toSelectorPointOrg'
		});
	}
	function showModalSelectorPointUser() {
		if($('#organizationInfo').val()==null || $('#organizationInfo').val()==''){
			layer.msg('请先选择负责部门!', {icon: 0});
			return;
		}
		var w=($(window).width()*0.9);
		var h=($(window).height() - 50);
		layer.open({
			type: 2,
			area: [w+'px', h +'px'],
			fix: true,
			maxmin: false,
			shadeClose: true,
			shade:0.4,
			title: "选择",
			content: '/web/business/tpDeptUserPoint/toSelectorPointUser?nodeLft='+$('#nodeLft').val() + '&nodeRgt=' + $('#nodeRgt').val()
		});
	}


</script>

</body>
</html>

